<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <style>
      .ul ul li {
        list-style: none;
        width: 50px;
        height: 20px;
        border: 1px solid red;
        float: left;
        text-align: center;
        line-height: 20px;
      }
      .img {
        width: 400px;
        height: 300px;
      }
      .img img {
        width: 100%;
      }
    </style>
  </head>
  <body>
    <div class="box" v-cloak>
      <div class="ul">
        <ul>
          <li
            v-bind:key="index"
            v-for="(item,index) in uls"
            @click="get"
            :data-index="++index"
          >
            {{item}}
          </li>
        </ul>
      </div>
      <div class="img">
        <img :src="srcs" alt="1" />
      </div>
    </div>

    <script src="../node_modules/vue/dist/vue.js"></script>
    <script>
      new Vue({
        el: '.box',
        data: {
          uls: [1, 2, 3, 4],
          srcs: './images/1.jpg',
        },
        methods: {
          get(e) {
            this.srcs = './images/' + e.target.dataset.index + '.jpg'
          },
        },
      })
    </script>
  </body>
</html>
